export default (config) => {
	console.log('customerValidate');
	let form = config['form'] || null;

	if(!form) {
		return;
	}

	let beforeFn = config['beforeFn'] || null;
	let afterFn = config['afterFn'] || null;
	let isFunction = function(fn) {
		return fn && typeof fn === 'function';
	}

	if(isFunction(beforeFn)){
		beforeFn();
	}

	form.validate( result => {
		if(!result) {
			return;
		}

		if(isFunction(afterFn)){
			afterFn();
		}
	})
}